Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

WIP: Relocation based build (inplace free) #445

Closed
wants to merge 232 commits into from

Conversation

angerman
Copy link
Collaborator

@angerman angerman commented Nov 1, 2017

This is essentially a reorganization on how libraries and ghc are built. The idea is to produce
ghc builds in _build/stage2/{bin,lib}, that could just be packed up and shipped around. This
also means there should be no more inplace files left.

This also includes a few additional changes:

  • gets rid of the Evac_thr, Scar_thr logic, that is not present in the Make base build system
  • make the cabal file parser a bit more powerful, such that it can configure packages, (it does not run the proper configure logic yet).

Things that do now yet work:

  • There are no wrapper scripts.
  • ghc --interactive fails to run, due to libgmp relocation issues
    Note this was due to hadrian relying on builing the in-tree-gmp on macOS. I believe
    this is equally broken in the make based build system.
  • No target prefixes yet. (e.g. arch-vendor-os-ghc).

Noteworthy:

Others:

The value of this has definitely been that I now know more about hacking on Hadrian.

NOTE: I do not expect this to be merged now. I want this to be more a basis
for discussion. I would have tried to make the same idea work with the make based
build system, but as Hadrian is the supposed way forward, I did not intend to waste
much time on the old(?) build system. I am going to pursue this direction further.

TODO:

  • Package Install / Registration Targets (stage+1). E.g. a library built with stage0 should be registers in the packageDb at stage1. Similar to how Programs built in stage0 end up in stage1/bin. This will also remove the need to copy the package.conf.d over from stage1 to stage2 to obtain the full stage2 compiler.
  • Reinstate wrapper rules
  • Drop the custom bootstrap db logic. (it's just the stage1 db then).
  • Reinstate the Install rules.
  • Check running the test suite.
  • Check building documentation.
  • Roll more of ghc-cabal into hadrian.

This allows to run it during the build without the wrapper.
Again, if ghc-pkg is run without a wrapper, we need to provide it with the flag.
No more /inplace/ logic.
This might need some rethinking, as we might want to rebuild them per stage (or copy?)

We could e.g. build them in stage0, and just copy them into stage1 and stage2.
This again should probably be done by having the package depend on the
right files.

ghc depends on settings, llvm-targets, platformConstants and the ghc/ghci-usage.txt files.
hsc2hs depends on the template.
hsc depends on the template-hsc.h, and ghc depends on settings, platformConstants, llvm-targets, ghc-usage.txt, ghci-usage.txt.

As such they will bring the files in on their own, and the copy target logic is no longer required.
E.g. buld ghc-cabal with stage0, it's part of the stage1 then.
angerman and others added 4 commits February 15, 2018 18:55
…/feature/reloc

# Conflicts:
#	src/Base.hs
#	src/Builder.hs
#	src/GHC.hs
#	src/Hadrian/Builder.hs
#	src/Rules/Documentation.hs
#	src/Rules/Install.hs
#	src/Settings/Builders/Hsc2Hs.hs
#	src/Settings/Builders/RunTest.hs
@alpmestan
Copy link
Collaborator

(Just adding a link as some sort of "TODO", for me to revisit my documentation rules patches to add --quickjump: ghc/ghc@9ff4cce)

@snowleopard
Copy link
Owner

snowleopard commented Feb 18, 2018

@alpmestan Oops, sorry, I've already rushed ahead with #505 to make sure I won't forget this.

@alpmestan
Copy link
Collaborator

No worries :)

alpmestan added a commit to alpmestan/hadrian that referenced this pull request Mar 19, 2018
This commit implements two significant changes (that were not easy to
separate):

- Don't use ghc-cabal anymore for getting information about Haskell packages.
  We now instead directly use Cabal-the-library.

- Make the build root configurable. This effectively gets rid of the inplace
  logic and allows us to place _all_ build artefacts in some directory of
  our choice, by passing '--build-root <some path>' to hadrian.

The code for this was mostly taken from snowleopard#445.
alpmestan added a commit to alpmestan/hadrian that referenced this pull request Mar 19, 2018
This commit implements two significant changes (that were not easy to
separate):

- Don't use ghc-cabal anymore for getting information about Haskell packages.
  We now instead directly use Cabal-the-library.

- Make the build root configurable. This effectively gets rid of the inplace
  logic and allows us to place _all_ build artefacts in some directory of
  our choice, by passing '--build-root <some path>' to hadrian.

The code for this was mostly taken from snowleopard#445.
alpmestan added a commit to alpmestan/hadrian that referenced this pull request Mar 19, 2018
This commit implements two significant changes (that were not easy to
separate):

- Don't use ghc-cabal anymore for getting information about Haskell packages.
  We now instead directly use Cabal-the-library.

- Make the build root configurable. This effectively gets rid of the inplace
  logic and allows us to place _all_ build artefacts in some directory of
  our choice, by passing '--build-root <some path>' to hadrian.

The code for this was mostly taken from snowleopard#445.
alpmestan added a commit to alpmestan/hadrian that referenced this pull request Mar 21, 2018
This commit implements two significant changes (that were not easy to
separate):

- Don't use ghc-cabal anymore for getting information about Haskell packages.
  We now instead directly use Cabal-the-library.

- Make the build root configurable. This effectively gets rid of the inplace
  logic and allows us to place _all_ build artefacts in some directory of
  our choice, by passing '--build-root <some path>' to hadrian.

The code for this was mostly taken from snowleopard#445.
snowleopard pushed a commit that referenced this pull request Mar 30, 2018
…le (#531)

* Use Cabal directly in place of ghc-cabal; make build root configurable.

This commit implements two significant changes (that were not easy to
separate):

- Don't use ghc-cabal anymore for getting information about Haskell packages.
  We now instead directly use Cabal-the-library.

- Make the build root configurable. This effectively gets rid of the inplace
  logic and allows us to place _all_ build artefacts in some directory of
  our choice, by passing '--build-root <some path>' to hadrian.

The code for this was mostly taken from #445.

* fix documentation rules

* remove some leftover unrelated, commented-out code

* more documentation fixes, address some feedback

* cleanup

* more cleanup

* boot and configure explicitly in travis CI scripts

* update cabal/ghc versions in .travis.yml (8.0.x not supported anymore)

* temporarily disable dynamic ways in Settings.Default

* update appveyor script

* travis: when booting with 8.2.2, build a complete stage2 compiler

* Fix CI?

Try to fix the CI by adding the `debug` rts way back in.

* Update Quickest.hs

Replicate the make build systems build flavours.

* Update .travis.yml

- Run selftest, and build in separate instances.
- try with python2
- and unify mac to stage2

* Update .travis.yml

upgrade python on mac

* [travis] os x: test the freshly built ghc

* Get rid of two unused GhcCabalMode constructors

* fix ghc-split rule, get rid of Install/Wrappers rules

* address more feedback

* ConfiguredCabal -> PackageData, more comments, more feedback addressed

* make the complete stage 2 build the default

* use a dummy package instead of base in Rules.hs

* update CI scripts

* attempt at fixing hadrian's -c option

* .travis.yml: use -c everywhere again

* travis: back to explicit './boot && ./configure'

* update README.md and doc/user-settings.md to reflect configurable build root

* some more feedback
@izgzhen
Copy link
Collaborator

izgzhen commented Apr 4, 2018

I’m curious what is left to be done in this PR after #531?

@alpmestan
Copy link
Collaborator

I’m curious what is left to be done in this PR after #531?

I think we're pretty much done, aren't we @angerman ? We got rid of the need for ghc-cabal, made the build root configurable, incorporated a bindist rule (it's even cleaner than the code that I wrote in this branch).

@snowleopard
Copy link
Owner

@alpmestan Sounds great! Once you are confident nothing has been lost, please close this PR.

@angerman
Copy link
Collaborator Author

Guess we can close this for now. If I'll end up with issues building my cross compilers again, I'll probably start a new branch.

@angerman angerman closed this Apr 17, 2018
@snowleopard
Copy link
Owner

@angerman Once again, many thanks for this amazing PR :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants